init:
    uv python install

# Define the build recipe
build: init doxygen doxysphinx sphinx

doxygen:
    # TODO: Fail early and explicitly if ../flightgear/ does not exist
    doxygen src/Doxyfile

doxysphinx:
    uv run doxysphinx build ./src ./build/ ./src/doxygen/html

sphinx:
    uv run sphinx-build -b html ./src ./build

# Recipe to start a local web-server and show the docs in a browser.
run:
    # Ensure docs are built if they haven't been built before.
    [ -d build ] || just build

    uv run python ./util/open-browser.py ./build

clean:
    # Delete build if it exists
    [ -d ./build/ ] && rm -r ./build/
    [ -d ./src/doxygen/ ] && rm -r ./src/doxygen/
